<?php get_instance()->view('common/header');?>
<script src="<?php echo $this->staticUrl?>js/base.js"></script>
<script src="<?php echo $this->staticUrl?>js/xingxing.js"></script>
<style>
    .hotserchbtnwid{color: #666;    border: 1px solid #666;}
    .hotserchbtnwid.active{color: #2c53de;    border: 1px solid #2c53de;}
    .starbox img{width: 16%}
    .starbox{cursor: auto !important;}
</style>
<body class="bag3">
<form action="" id="save-form" method="post">
    <?php foreach ($product as $v):?>
        <div>
            <div class="hengleft bag1 p3p vCenter" >
                <div class="item-img oh f07 mr5"><img src="<?php echo $v['icon']?>" alt=""></div>
                <p class="mr15 f085">描述相符</p>
                <div class="heng vCenter">
                    <div id="xing<?php echo $v['order_product_id']?>" class="heng vCenter starbox"></div>
                    <input type="hidden" class="productScore" name="product_score[]" value="">
                </div>
                <input type="hidden" class="productId" name="order_product_id[]" value="<?php echo $v['order_product_id']?>">
            </div>
            <div class="weui-gallery" id="gallery<?php echo $v["order_product_id"]?>">
                <span class="weui-gallery__img" id="galleryImg<?php echo $v["order_product_id"]?>"></span>
                <div class="weui-gallery__opr">
                    <a href="javascript:" class="weui-gallery__del">
                        <i class="weui-icon-delete weui-icon_gallery-delete"></i>
                    </a>
                </div>
            </div>
            <div class="weui-cells weui-cells_form mt0">
                <div class="weui-cell">
                    <div class="weui-cell__bd">
                        <textarea name="content[]" class="weui-textarea f07" placeholder="说说您对商品的看法和建议..." rows="1"></textarea>
                        <div class="weui-textarea-counter f09"><span>0</span>/300</div>
                    </div>
                </div>
                <div class="weui-cell">
                    <div class="weui-cell__bd">
                        <div class="weui-uploader">
                            <div class="weui-uploader__bd">
                                <ul class="weui-uploader__files" id="uploaderFiles<?php echo $v["order_product_id"]?>">

                                </ul>
                                <div class="weui-uploader__input-box jdjz">
                                    <img src="<?php echo $this->staticUrl?>img/png/pic104.png">
                                    <input id="uploaderInput<?php echo $v["order_product_id"]?>" class="weui-uploader__input chooseImage" type="file" accept="image/*" multiple/>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <script type="text/javascript">
                $(function () {
                    weUiImg({
                        name:'images<?php echo $v['order_product_id']?>[]',
                        imagesNumber:6,
                        changeImagesNumber:6,
                        inputId:'uploaderInput<?php echo $v["order_product_id"]?>', // 上传file的id名称
                        filesId:'uploaderFiles<?php echo $v["order_product_id"]?>', // 存图片的ui标签id名称
                        gallery:'gallery<?php echo $v["order_product_id"]?>',       // 预览标签id名称
                        galleryImg:'galleryImg<?php echo $v["order_product_id"]?>' // 删除的id名称
                    });
                })
            </script>
        </div>
    <?php endforeach;?>
    <div class="bag1">
        <div class="f12 waper bag1 heng vCenter itemitem">
            <div class="left f08 vCenter"><span><img class="lefttitleimg mr5 di mbmin" src="<?php echo $this->staticUrl?>img/png/pic25.png" alt="">店铺</span></div>
        </div>
        <div class="ml5">
            <?php foreach ($merchant_tags as $v):?>
            <b class="storeTag hotserchbtnwid fl"><?php echo $v?></b>
            <?php endforeach;?>
            <h6></h6>
        </div>
        <div class="hengleft bag1 p3p vCenter">
            <p class="mr15 f08">店铺评分</p>
            <div class="heng vCenter">
                <div id="xingStore" class="heng vCenter starbox"></div>
            </div>
        </div>
    </div>
    <?php if($delivery):?>
    <div class="pb20 mt7 bag1">
        <div class="f12 waper bag1 heng vCenter itemitem">
            <div class="left f08 vCenter"><span><img class="lefttitleimg mr5 di mbmin" src="<?php echo $this->staticUrl?>img/png/pic25.png" alt="">配送员</span></div>
        </div>
        <div class="ml5">
            <?php foreach ($dlyTag as $v):?>
                <b class="deliveryTag hotserchbtnwid fl"><?php echo $v?></b>
            <?php endforeach;?>
            <h6></h6>
        </div>
        <div class="pl5">
            <div class="hengleft">
                <div class="zzzuserimg imgbox"><img src="<?php echo $delivery['portrait']?>" alt=""></div>
                <div class="">
                    <h1 class="mb5"><?php echo $delivery['name']?></h1>
                    <div class="heng vCenter">
                        <div id="xingDly" class="heng vCenter starbox"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <?php endif;?>
    <div class="pb20">
        <input type="hidden" name="order_id" value="<?php echo get('order_id');?>">
        <input type="hidden" name="service_tags" value="">
        <input type="hidden" name="service_score" value="5">
        <input type="hidden" name="deliveryman_score" value="">
        <input type="hidden" name="deliveryman_tags" value="">
        <button class="kbtn" onClick="javascript:formSubmit();">提交</button>
    </div>
</form>
</body>

<script>
    var product = <?php echo json_encode(array_column($product,'order_product_id'));?>;
    $(function() {
        $.e_validate.init('#save-form',{saveMessage:'保存中...'});

        $.fn.raty.defaults.path = '<?php echo $this->staticUrl?>img/png';

        $('#xingStore').raty();
        $('#xingDly').raty();

        $.each(product,function(key,val){
            $('#xing'+val).raty();
        })

        $(".hotserchbtnwid").click(function(){
            if($(this).hasClass("active")){
                $(this).removeClass("active");
            }else {
                $(this).addClass("active");
            }
        })

    });
    //默认5颗星
    $(function () {
        $(".starbox").find("img").attr("src",'<?php echo $this->staticUrl?>img/png/pic11.png');
        $('input[name="score"]').val('5');

    });
    function formSubmit() {
        //店铺标签
        var storeTag = '';
        var storeLen = $(".storeTag").length;
        $(".storeTag").each(function(i,dom){
            if($(this).hasClass('active')){
                storeTag += $(this).text()+',';
            }
        });
        var dlyScore = $('#xingDly').find('input[name="score"]').val();

        //配送标签
        var deliveryTag = '';
        var deliveryLen = $(".storeTag").length;
        $(".deliveryTag").each(function(i,dom){
            if($(this).hasClass('active')){
                deliveryTag += $(this).text()+',';
            }
        });
        var storeScore = $('#xingStore').find('input[name="score"]').val();
        //商品评分
        $.each(product,function(key,val){
            var pro = $('#xing'+val).find('input[name="score"]');
            pro.parent().next().val(pro.val());
        })

        $('input[name="service_tags"]').val(storeTag);
        $('input[name="service_score"]').val(storeScore);
        $('input[name="deliveryman_score"]').val(dlyScore);
        $('input[name="deliveryman_tags"]').val(deliveryTag);
        $("#form").submit();
    }
</script>

</html>